import  {  legacy_createStore  as  createStore , applyMiddleware }   from 'redux'

import  thunk   from 'redux-thunk'

import  {composeWithDevTools}  from 'redux-devtools-extension'

import  rootReducer from './reducers'
import { getToken } from '@/utils/token'


const initialState = {
   // 注意：此处的 login 属性是根据合并reducer时，login 的名称而来的
   login: getToken(),
}


const  middlewares = composeWithDevTools(applyMiddleware(thunk))

const store=  createStore(rootReducer,initialState,middlewares)

export  default  store